<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript" src="jquery/jquery-1.11.3.js"></script>
        <script type="text/javascript">
            $(function(){
                //css位置选择器
                //找tbody中的第二个tr节点
                //找到李四
//                $("tbody tr:nth-child(2)").css("color","#f00");
                
                //找到所有tr中第二个td
//                $("tbody td:nth-child(2)").css("color","#f00");
                
                //找tr所有的偶数节点 odd奇数
//                $("tbody tr:nth-child(even)").css("background","#999");
                
                //找到偶数  从0开始记数  有点问题，老师跳过
//                $("tbody tr:even").css("background","#aaa");
                
                //找到大于2
//                $("tbody tr:gt(2)").css("background","#aaa");
                
                // 包含文本有2的所有元素
                $("td:contains('2')").css("background","#aaa");
            });
                
                
        </script>
    </head>
    <body>
        <table width="700" border="1" align="center">
            <thead>
                <tr>
                    <td>用户标识</td>
                    <td>用户姓名</td>
                    <td>用户年龄</td>
                    <td>用户密码</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>张三</td>
                    <td>23</td>
                    <td>abc123</td>
                </tr>
                <tr>
                    <td>2</td>
                    <td>李四</td>
                    <td>33</td>
                    <td>abc123</td>
                </tr>
                <tr>
                    <td>3</td>
                    <td>王五</td>
                    <td>13</td>
                    <td>abc123</td>
                </tr>
                <tr>
                    <td>4</td>
                    <td>赵六</td>
                    <td>45</td>
                    <td>abc123</td>
                </tr>
                <tr>
                    <td>5</td>
                    <td>朱琪</td>
                    <td>21</td>
                    <td>abc123</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
